package day1.homework;

import java.io.File;
import java.io.IOException;

public
class demo1 {
    public static
    void main(String[] args) throws IOException {
        File f=new File("d://HelloWorld.txt");
        if(f.isFile()){
            System.out.println("f是文件");
        }else if(f.isDirectory()){
            System.out.println("f是目录");
        }
        File f2=new File("d://IOTest//HelloWorld.txt");
        f2.getParentFile().mkdir();
        f.renameTo(f2);
        //getParentFile() 获取父目录的File对象
        String[] list=f2.getParentFile().list();
        for (String s : list) {
            System.out.println(s);
        }
    }


}
